package com.securitydemo.converter;

import com.securitydemo.dao.entity.UserEntity;
import com.securitydemo.dto.UserRegisterDto;
import com.securitydemo.securitylogin.LoginUser;
import org.springframework.beans.BeanUtils;

public class UserConverter {
    public static LoginUser from(UserEntity userEntitiesByUsername) {
        LoginUser loginUser=new LoginUser();
        BeanUtils.copyProperties(userEntitiesByUsername,loginUser);
        return loginUser;
    }

    public static UserEntity to(UserRegisterDto dto) {
        UserEntity entity=new UserEntity();
        entity.setUsername(dto.getUsername());
        entity.setPassword(dto.getPassword());
        return entity;
    }
}
